// ✅ Функция работает с ЛЮБЫМ непрерывным контейнером! void processData(std::span<const int> data) { for (const auto& item : data) { // Обработка } }
int main() { // Работает с std::vector std::vector<int> vec = {1, 2, 3, 4, 5}; processData(vec);
// Работает с std::array std::array<int, 3> arr = {10, 20, 30}; processData(arr);
// Работает с C-массивами int classic[] = {100, 200, 300}; processData(classic);
// Работает с подпоследовательностями! processData(std::span(vec).subspan(1, 3)); // Только элементы 2,3,4 }
❗️Преимущества std::span:
- Не владеет данными (zero overhead) - Безопасно передает подпоследовательности - Унифицированный интерфейс для всех контейнеров - Выразительный код без шаблонных параметров
// ✅ Функция работает с ЛЮБЫМ непрерывным контейнером! void processData(std::span<const int> data) { for (const auto& item : data) { // Обработка } }
int main() { // Работает с std::vector std::vector<int> vec = {1, 2, 3, 4, 5}; processData(vec);
// Работает с std::array std::array<int, 3> arr = {10, 20, 30}; processData(arr);
// Работает с C-массивами int classic[] = {100, 200, 300}; processData(classic);
// Работает с подпоследовательностями! processData(std::span(vec).subspan(1, 3)); // Только элементы 2,3,4 }
❗️Преимущества std::span:
- Не владеет данными (zero overhead) - Безопасно передает подпоследовательности - Унифицированный интерфейс для всех контейнеров - Выразительный код без шаблонных параметров
Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.
Telegram announces Anonymous Admins
The cloud-based messaging platform is also adding Anonymous Group Admins feature. As per Telegram, this feature is being introduced for safer protests. As per the Telegram blog post, users can “Toggle Remain Anonymous in Admin rights to enable Batman mode. The anonymized admin will be hidden in the list of group members, and their messages in the chat will be signed with the group name, similar to channel posts.”
Библиотека C C разработчика | cpp boost qt from id